<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head th:include="common/admin-header::header">
    <title>接口管理</title>
</head>

<body class="app sidebar-mini rtl">
<div th:replace="common/admin-sadbar::sadbar"></div>

<!-- add Modal -->
<div th:replace="common/modal/interface-modal::interface_add_modal"></div>
<div th:replace="common/modal/interface-modal::interface_update_modal"></div>


<main class="app-content">
    <div class="app-title">
        <div>
            <h1><i class="fa fa-plug"></i> 接口列表</h1>
            <p>接口管理</p>
        </div>
        <ul class="app-breadcrumb breadcrumb">
            <li class="breadcrumb-item"><i class="fa fa-home fa-lg"></i></li>
            <li class="breadcrumb-item"><a href="#">接口</a></li>
        </ul>
    </div>

    <div class="row">


        <div class="col-md-12">
            <div class="tile">
                <div class="tile-body">

                    <div class="offset-md-10">
                        <button class="btn btn-primary" data-toggle="modal"
                                data-target="#interface_add_modal" th:onclick="addInterfaceModalShow()"><i
                                class="fa fa-plus" aria-hidden="true"></i>新增接口
                        </button>
                        <button class="btn btn-danger" data-toggle="modal"
                                data-target="#">批量删除
                            <!--todo 批量删除接口功能-->
                        </button>
                    </div>


                    <hr>
                    <table class="table table-hover table-bordered" style="white-space: nowrap" id="sampleTable">
                        <thead>
                        <tr>
                            <th th:class="text-center">接口编号</th>
                            <th th:class="text-center">名称</th>
                            <th th:class="text-center">URI</th>
                            <th th:class="text-center">所属项目</th>
                            <th th:class="text-center">模板ID</th>
                            <th th:class="text-center">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr th:each="interface:${interfaces}">
                            <td th:class="text-center"><a>[[${interface.getInterfaceId()}]]</a></td>
                            <td th:text="${interface.getInterfaceName()}" th:class="text-center">interface name</td>
                            <td th:text="${interface.getUri()}" th:class="text-center">URI</td>
                            <td th:text="${interface.getProject().getProjectName()}" th:class="text-center">所属项目</td>
                            <td th:text="${interface.getExampleId()}" th:class="text-center">exampleID</td>
                            <td th:class="text-center">
                                <button class="btn btn-sm btn-info"
                                        th:onclick="updateInterfaceModalShow([[${interface.getInterfaceId()}]])"
                                        data-toggle="modal"
                                        data-target="#interface_update_modal"><i class="fa fa-edit"
                                                                                 aria-hidden="true"></i>修改
                                </button>

                                <button class="btn btn-sm btn-danger" name="deleteInterfaceBtn"
                                        th:interfaceId="${interface.getInterfaceId()}"
                                        th:exampleid="${interface.getExampleId()}">
                                    <i class="fa fa-remove" aria-hidden="true"></i>删除
                                </button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</main>

<div th:include="common/script::script"></div>

<script type="text/javascript">$('#sampleTable').DataTable();</script>

<script th:src="@{/static/flytest-js/interface.js}"></script>
<script th:src="@{/static/flytest-js/util.js}"></script>

</body>
</html>